class Priority:
    
    def __init__ (self, aList):
        self.queue = aList
        
    def takeProgram(self):
        
        l=len(self.queue)
        return self.queue.pop(l-1)
    
    def addPcb(self, aPcb):
        self.queue.append(aPcb)
        self.queue = sorted(self.queue, key = lambda pcb:pcb.priority)
        
    def __repr__(self):
        return 'ready%s'%(self.queue)
    
    def isEmpty(self):
        return len(self.queue) == 0